//router/index2.tsx
import {useDevice} from "../utils/ResizeHandle.ts";
import {LayOut1, LayOut2} from "../layout/index.tsx";
import {BrowserRouter, Route, Routes} from "react-router-dom";
import OnAuthCallback from "../components/onAuthCallback.tsx";
import {useCurDevice, useUserToken} from "../stores/hooks/index.ts";
import {useEffect} from "react";
import Login from "../components/Login.tsx";
import {Auth} from "../type/Auth.ts";
import AuthInterceptor from "./AuthInterceptor.tsx";



 const AppRouter=()=>{
     //监测设备与获取设备
    useDevice();
    const curDevice=useCurDevice();
    //获取用户token
    const Token=useUserToken();
    const Auth_State=localStorage.getItem(Auth.STATE);
    useEffect(()=>{
         return ()=>{



         }
     },[])

    const Layout=curDevice==="desktop" ? <LayOut2/>  : <LayOut1/> ;

    return(<BrowserRouter>
            <Routes>
                <Route path='/' element={<AuthInterceptor>{Layout}</AuthInterceptor>}></Route>
                <Route path='/auth/callback' element={<OnAuthCallback/>}></Route>
                <Route path='/login' element={<Login/>}></Route>
            </Routes>
         </BrowserRouter>
      )
}
export default AppRouter;
